package com.lindroy.jetpacknotes.lifecycle.lifecycle_service

import android.util.Log
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner

/**
 * @author Lin
 * @date 2021/12/20
 * @function
 */
class MyServiceObserver : DefaultLifecycleObserver {
    private val TAG = "Lifecycle-Service"

    override fun onCreate(owner: LifecycleOwner) {
        super.onCreate(owner)
        Log.d(TAG, "Start Service")
    }

    override fun onDestroy(owner: LifecycleOwner) {
        super.onDestroy(owner)
        Log.d(TAG, "Stop Service")

    }
}

class MyServiceObserver2: LifecycleEventObserver{
    override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {

    }
}